<%@ Page Language="C#" MasterPageFile="~/Base.Master" AutoEventWireup="true" CodeBehind="Person.aspx.cs" Inherits="SVAccountingWebUI.Person" %>
<%@ MasterType VirtualPath="~/Base.Master" %>

<asp:Content ID="PersonContent" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    
    
    
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" 
        DataKeyNames="UserName" BackColor="White" BorderColor="#999999" 
        BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" 
        GridLines="Vertical">
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" ImageUrl="~/Icons/Update.png" Text="Update" />
                    &nbsp;<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" ImageUrl="~/Icons/Cancel.png" Text="Cancel" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" ImageUrl="~/Icons/Edit.png" Text="Edit" />
                    &nbsp;<asp:ImageButton ID="DeleteButton" runat="server" CausesValidation="False" 
                        CommandName="Delete" ImageUrl="~/Icons/delete.png" Text="Delete"
                        message="<%$ Resources:Resource, DeleteConfirm %>" 
                        OnClientClick='return confirm(this.getAttribute("message"))'
                        />
                    <asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" 
                        CommandName="Select" ImageUrl="~/Icons/Select.png" Text="Select" />
                    &nbsp;
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="UserID" HeaderText="UserID" 
                SortExpression="UserID" ReadOnly="True" />
            <asp:BoundField DataField="UserName" HeaderText="UserName" 
                SortExpression="UserName" ReadOnly="True" />
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:CheckBoxField DataField="IsApproved" HeaderText="IsApproved" 
                SortExpression="IsApproved" />
            <asp:TemplateField HeaderText="UserRoleName" SortExpression="UserRoleName">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ODSRolles" 
                        DataTextField="RoleName" DataValueField="RoleName" 
                        SelectedValue='<%# Bind("UserRoleName") %>'>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="ODSRolles" runat="server" 
                        OldValuesParameterFormatString="original_{0}" SelectMethod="Rolles" 
                        TypeName="SVAccountingBL.UsersODS"></asp:ObjectDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("UserRoleName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CheckBoxField DataField="IsOnline" HeaderText="IsOnline" 
                SortExpression="IsOnline" ReadOnly="True" />
            <asp:CheckBoxField DataField="IsLockedOut" HeaderText="IsLockedOut" 
                SortExpression="IsLockedOut" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="#CCCCCC" />
        </asp:GridView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                DataObjectTypeName="SVAccountingBL.UserWraper" DeleteMethod="DeleteUser" 
                InsertMethod="InsertUser" OldValuesParameterFormatString="original_{0}" 
                SelectMethod="GetAllUsers" TypeName="SVAccountingBL.UsersODS" 
                UpdateMethod="UpdateUserInfo"></asp:ObjectDataSource>
        
        <br />
        <br />
        <div id="divAccountantCompanies" runat="server" visible="false">
        <table>
        <tr align="right">
        <td align="left">
         <h4>
                <asp:Label ID="lblAccountantCompaniesInfo" runat="server" Text="<%$ Resources:Resource, AccountantCompaniesInfo %>" />
                </h4>
        </td>
            <td align="right">
                <asp:DropDownList ID="ddlFreeCompanies" runat="server">
                </asp:DropDownList>
            </td>
            <td align="left">
            <asp:ImageButton ID="imgbtnAddUserToProject" runat="server" 
                      ImageUrl="~/Icons/Add.png" Visible="false" 
                      onclick="imgbtnAddUserToProject_Click" Width="18px" />
            </td>
        </tr>
        <tr>
            <td colspan="3">
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                DataSourceID="ODSCompaniesAccountant" CellPadding="4" ForeColor="#333333" 
                GridLines="None" DataKeyNames="CompanyID" >
                <RowStyle BackColor="#E3EAEB" />
                <Columns>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:ImageButton ID="DeleteButton" runat="server" CausesValidation="False" 
                        CommandName="Delete" ImageUrl="~/Icons/delete.png" Text="Delete"
                        message="<%$ Resources:Resource, DeleteConfirm %>" 
                        OnClientClick='return confirm(this.getAttribute("message"))'
                        />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="CompanyID" HeaderText="CompanyID" 
                        SortExpression="CompanyID" />
                    <asp:BoundField DataField="CompanyName" HeaderText="CompanyName" 
                        SortExpression="CompanyName" />
                    <asp:BoundField DataField="Address" HeaderText="Address" 
                        SortExpression="Address" />
                    <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
                    <asp:BoundField DataField="CreatedDate" HeaderText="CreatedDate" 
                        SortExpression="CreatedDate" />
                    <asp:BoundField DataField="EnrolmentType" HeaderText="EnrolmentType" 
                        SortExpression="EnrolmentType" />
                </Columns>
                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#7C6F57" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
            <asp:ObjectDataSource ID="ODSCompaniesAccountant" runat="server" 
                OldValuesParameterFormatString="original_{0}" 
                SelectMethod="GetAccountnatCompanies" TypeName="SVAccountingBL.UsersODS" 
                    DeleteMethod="RemoveCompanyFromAccountant" 
                    InsertMethod="AssosiateCompanyToAccountatn" 
                    ondeleted="ODSCompaniesAccountant_Deleted" 
                    oninserted="ODSCompaniesAccountant_Inserted" 
                    ondeleting="ODSCompaniesAccountant_Deleting" 
                    DataObjectTypeName="SVAccountingBL.Company">
                <SelectParameters>
                    <asp:ControlParameter ControlID="GridView1" Name="userName" 
                        PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
                <InsertParameters>
                    <asp:Parameter Name="userName" Type="String" />
                    <asp:Parameter Name="companyID" Type="String" />
                </InsertParameters>
            </asp:ObjectDataSource>
            </td>
        </tr>
        </table>
        </div>
        
    
    
    
</asp:Content>